#include "motor_a_encoder_config.h"
// encoder框架
#include "encoder.h"
// spi驱动
#include "motor_a_spi1_encoder.h"
// iic驱动
#include "motor_a_iic1_encoder.h"
// delay实现
#include "delay.h"


#if MOTORA_USE_TLE5012

TLE5012B_Struct MotorA_Encoder = 
{
	.angleOffect	= 150.153854f,			// 零角度偏差
	.SetCSLeave		= MOTORA_SPI1SetCS,		// 设置片选
	.SPIWrite		= MOTORA_SPI1WriteData,	// SPI写数据
	.SPIRead		= MOTORA_SPI1ReadData,	// SPI接收数据
	.Delay_us		= delay_us,
};

/**
 * @brief   获取电机A机械角度
 *
 * @param   none
 *
 * @return  none
 */
float MOTORA_GetEncoderAngle(void)
{
	return ReadTLE5012BAngle(&MotorA_Encoder);
}

#elif MOTORA_USE_AS5600

AS5600_Struct MotorA_Encoder = 
{
	.angleOffect	= 150.153854f,			// 零角度偏差
	.IICWrite		= MOTORA_IIC1WriteData,	// IIC写数据
	.IICRead		= MOTORA_IIC1ReadData,	// IIC接收数据
};

/**
 * @brief   获取电机A机械角度
 *
 * @param   none
 *
 * @return  none
 */
float MOTORA_GetEncoderAngle(void)
{
	return ReadAS5600Angle(&MotorA_Encoder);
}

#endif






